$().ready(function() {
	// 提交时验证表单
	var validator = $("AddMember").validate({
		errorPlacement: function(error, element) {
			// Append error within linked label
			$( element )
				.closest( "form" )
					.find( "label[for='" + element.attr( "id" ) + "']" )
						.append( error );
		},
		errorElement: "span",
		messages: {
			realname: {
				required: " (必需字段)",
				minlength: " (不能少于 2 个字符)"
			},
			idcard: {
				required: " (必需字段)",
				minlength: " (字段为18个字符)",
				maxlength: " (字段为18个字符)"
			},
			reward: {
				required: " (必需字段)",
				minlength: " (不能少于 1 个字符)",
				
			}
		}
	});

	/*$(".cancel").click(function() {
		validator.resetForm();
	});*/
});


window.onload = function(){
	function getDate(){
/* 	debugger; */
	var today = new Date(); 
	var date; 
	date = (today.getFullYear()) +"-" + (today.getMonth() + 1 ) + "-" + today.getDate(); 
	return date;
	}
	window.setInterval(function(){
	document.getElementById("create_time").value=getDate();
	}, 1000);
	}


	function ic()
	{
	/*  var idcard=/^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
	if(idcard.test($("idcard").value))
	{ alert("ok"); }
	else{alert("身份证号为空或错误");} */

	var CardName=document.getElementById("idcard").value;
	var name=CardName.substr(10,17);
	document.getElementById("name").value=name;

	}
